//管理员端查看某一条模板权重信息接口
package xiangmu.schoolpaper.controller.system;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import xiangmu.schoolpaper.service.system.SelectTemplateTypeService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@RestController
@RequestMapping("/api/template")

@Slf4j
@Tag(name = "查找模板要素权重接口")
public class SelectTemplateTypeController {

    private final SelectTemplateTypeService selectTemplateTypeService;

    // 使用构造器注入
    @Autowired

    public SelectTemplateTypeController(SelectTemplateTypeService selectTemplateTypeService) {
        this.selectTemplateTypeService = selectTemplateTypeService;
    }

    /**
     * 查看某一条权重模板信息
     * @param templateId 模板ID
     * @return 权重值列表
     */
    @GetMapping("/getWeightsTemplateId")

    @Operation(summary = "查找模板要素权重接口")
    public List<Double> getWeightsByTemplateId(@RequestParam Integer templateId) {
        log.info("查找模板要素权重接口");
        return selectTemplateTypeService.getWeightsByTemplateId(templateId);
    }
}